package vno.fux.ui
{
	import vno.fux.BasePoint;
	import vno.fux.GlobalVar;
	public class WalkTargetController extends BaseComponentController
	{
		public function WalkTargetController(model_:BaseComponentModel)
		{
			super(model_);
		}
		
		public function handlePosUpdate(nowPos_:BasePoint):void
		{
			_model.pos.x = (_model as WalkTargetModel).end.x-nowPos_.x + 1/2*GlobalVar.stage.stageWidth;
			_model.pos.y = (_model as WalkTargetModel).end.y-nowPos_.y + 1/2*GlobalVar.stage.stageHeight;
			_model.update();
		}
		public function startMove(start_:BasePoint, end_:BasePoint):void
		{
			(_model as WalkTargetModel).start = start_;
			(_model as WalkTargetModel).end = end_;
			_model.pos.x = end_.x-start_.x + 1/2*GlobalVar.stage.stageWidth;
			_model.pos.y = end_.y-start_.y + 1/2*GlobalVar.stage.stageHeight;
			_model.update();
		}
		
		public function handleUnreach(pos:BasePoint):void
		{
			_model.pos = pos;
			_model.update();
		}
	}
}